package com.common.springbootcommonmessage.enums;

import java.util.HashMap;

public enum WorkStatus {
    Pending(1), Verify(2), PickReceive(3), Ship(4);

    private final Integer value;
    private static HashMap<Integer, WorkStatus> integerMap = new HashMap<Integer, WorkStatus>();
    private static HashMap<String, Integer> workMap        = new HashMap<>();

    WorkStatus(Integer value) {
        this.value = value;
    }

    static {
        for (WorkStatus status : WorkStatus.values()) {
            integerMap.put(status.getValue(), status);
            workMap.put(status.name(), status.getValue());
        }
    }

    public Integer getValue() {
        return this.value;
    }

    public static WorkStatus valueOf(Integer value) {
        return (WorkStatus) integerMap.get(value);
    }

    public static Integer getStatusByName(String name) {
        return (Integer) workMap.get(name);
    }
}